Repository navigation
fix(aggregator): post-alert rejects unknown/duplicated arguments (#7289) - #7295
Merged
Merged
Conversation
…re any token resolution or post (#7289)
developing-today
Bot
requested review from
a team and
dezren39
as code owners
November 8, 2026 05:01
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7289.
post-alert.ts probed argv only with indexOf, so unknown/misspelled/joined/duplicated arguments and stray positionals were silently ignored: a typo'd --severty posted a warning incident as critical (the ?? "critical" default), --severity=warning did the same, and a typo'd --bodi silently dropped the body — all exit 0 (probe: ~/git/fleet/probe-post-alert-unknown-args, stub intake + stub bws, real script verbatim).
Fix: rejectUnknownArgs() in scripts/post-alert.ts, mirroring generate-digest.ts (#7097) / collect-github-billing.ts (#7254) — every argv token must be one of the five documented value flags, each at most once; anything else is a usage error naming the token, exit 2, before any token resolution or fetch. A flag's value token is consumed by its flag; arg() still validates it (#3723 behavior unchanged).
Tests: new test/post-alert-unknown-args-7289.test.ts (subprocess + stub intake/bws, the #3723 pattern) — control posts exactly the named incident; typo'd --severty, joined --severity=warning, unknown --bogus, typo'd --bodi, duplicate --severity, and a stray positional each exit 2 with no bws call and no POST. Verified on the laptop: new + #3723 suites 5/5 pass on the branch; the new regression test fails on the pre-fix script (control passes).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.